package com.br.negocio.vo;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

@Entity
@Table(name = "funcionario")
@SequenceGenerator(name = "funcionario_seq", sequenceName = "funcionario_cod_funcionario_seq", allocationSize = 1)
@NamedQueries ({
	@NamedQuery(name = "loadAllFuncionario", query = "from FuncionarioVO as f order by f.codigo"),
	@NamedQuery(name = "findFuncionario", query = "from FuncionarioVO as f where f.codigo = :codigo"),
	@NamedQuery(name = "findDuplicatedFuncionario", query = "from FuncionarioVO as f where f.cpf = :cpf and f.codigo != :codigo")
})
public class FuncionarioVO extends PessoaVO implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "cod_funcionario")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "funcionario_seq")
	private int codigo;
	
	@Column(name = "nome", length = 50)
	private String nome;
	
	@Column(name = "rg", length = 20)
	private String rg;
	
	@Column(name = "cpf", length = 20)
	private String cpf;
	
	@Column(name = "ctps", length = 20)
	private String ctps;
	
	@Column(name = "salario")
	private float salario;
	
	@Column(name = "telefone_residencial", length = 8)
	private String telefoneResidencial;
	
	@Column(name = "telefone_celular", length = 8)
	private String telefoneCelular;

	@Column(name = "email", length = 50)
	private String email;
	
	@Column(name = "cod_sexo")
	private int sexo;
	
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "cod_cargo")
	@Fetch(FetchMode.JOIN)
	private CargoVO cargoVO;
	
	
	@Temporal(TemporalType.DATE)
	@Column(name = "data_nascimento")
	private Date dataNascimento;
	
	@Temporal(TemporalType.DATE)
	@Column(name = "data_admissao")
	private Date dataAdmissao;
	
	@Temporal(TemporalType.DATE)
	@Column(name = "data_demissao")
	private Date dataDemissao;
	

	
	private UsuarioVO usuarioVO;
	
	public FuncionarioVO() {
		super();

	}
	


	public int getCodigo() {
		return this.codigo;
	}

	public void setCodigo(int codigo) {
		this.codigo = codigo;
	}

	public String getNome() {
		return this.nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}
	
	public String getRg() {
		return this.rg;
	}

	public void setRg(String rg) {
		this.rg = rg;
	}
	
	public String getCpf() {
		return this.cpf;
	}

	public void setCpf(String cpf) {
		this.cpf = cpf;
	}
	
	public String getCtps() {
		return this.ctps;
	}

	public void setCtps(String ctps) {
		this.ctps = ctps;
	}
	
	public float getSalario() {
		return salario;
	}

	public void setSalario(float salario) {
		this.salario = salario;
	}

	public String getTelefoneResidencial() {
		return this.telefoneResidencial;
	}

	public void setTelefoneResidencial(String telefoneResidencial) {
		this.telefoneResidencial = telefoneResidencial;
	}

	public String getTelefoneCelular() {
		return this.telefoneCelular;
	}

	public void setTelefoneCelular(String telefoneCelular) {
		this.telefoneCelular = telefoneCelular;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public CargoVO getCargoVO() {
		return this.cargoVO;
	}

	public void setCargoVO(CargoVO cargoVO) {
		this.cargoVO = cargoVO;
	}
	
	public int getSexo() {
		return sexo;
	}

	public void setSexo(int sexo) {
		this.sexo = sexo;
	}

	public Date getDataNascimento() {
		return this.dataNascimento;
	}

	public void setDataNascimento(Date dataNascimento) {
		this.dataNascimento = dataNascimento;
	}
		
	public Date getDataAdmissao() {
		return this.dataAdmissao;
	}

	public void setDataAdmissao(Date dataAdmissao) {
		this.dataAdmissao = dataAdmissao;
	}

	public Date getDataDemissao() {
		return this.dataDemissao;
	}

	public void setDataDemissao(Date dataDemissao) {
		this.dataDemissao = dataDemissao;
	}

	

	public UsuarioVO getUsuarioVO() {
		return this.usuarioVO;
	}

	public void setUsuarioVO(UsuarioVO usuarioVO) {
		this.usuarioVO = usuarioVO;
	}
	
}